// $Id: interface_def.hpp 2 2009-09-02 08:47:42Z joseph2002 $
/*
 * Copyright 2009 Joseph Wu
 * Distributed under the Boost Software License, Version 1.0.
 * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 *
 * For more information, see http://xpcomplus.sourceforge.net
 */

#ifndef XPCOM_TEST_PUBLIC_INTERFACE_DEF_HPP
#define XPCOM_TEST_PUBLIC_INTERFACE_DEF_HPP

#include <xpcom/interface.hpp>

int X_count();
void X_count(int n);

struct X_count_guard
{
    X_count_guard() : count_(X_count()) {}
    ~X_count_guard() { X_count(count_); }
    int count_;
};

struct IBase : public xpcom::interface
{
    virtual xpcom::refcnt_t ref() = 0;
    virtual int getN() = 0;
    virtual void setN(int n) = 0;
};

struct IA : public IBase
{
    virtual int getA() = 0;
    virtual void setA(int a) = 0;
};

struct IB : public IBase
{
    virtual int getB() = 0;
    virtual void setB(int b) = 0;
};

struct IC : public IB
{
    virtual int getC() = 0;
    virtual void setC(int c) = 0;
};

struct ID : public xpcom::interface
{
    virtual int getD() = 0;
    virtual void setD(int d) = 0;
};

IBase* X_make_instance();

namespace xpcom {

XPCOM_TYPE_INFO_DECL(IBase, interface)
// {2F572AA2-653E-466c-A65D-4F607EAEB54B}
XPCOM_TYPE_INFO_ID(IBase, { 0x2f572aa2, 0x653e, 0x466c, { 0xa6, 0x5d, 0x4f, 0x60, 0x7e, 0xae, 0xb5, 0x4b } })

XPCOM_TYPE_INFO_DECL(IA, IBase)
// {78F4A679-35ED-4cd0-A654-4432C304FA58}
XPCOM_TYPE_INFO_ID(IA, { 0x78f4a679, 0x35ed, 0x4cd0, { 0xa6, 0x54, 0x44, 0x32, 0xc3, 0x4, 0xfa, 0x58 } })

XPCOM_TYPE_INFO_DECL(IB, IBase)
// {825230FC-DFE6-45db-AD98-C44C9E56A176}
XPCOM_TYPE_INFO_ID(IB, { 0x825230fc, 0xdfe6, 0x45db, { 0xad, 0x98, 0xc4, 0x4c, 0x9e, 0x56, 0xa1, 0x76 } })

XPCOM_TYPE_INFO_DECL(IC, IB)
// {09C5F34E-B1EF-436a-AAA1-64F16E08E014}
XPCOM_TYPE_INFO_ID(IC, { 0x9c5f34e, 0xb1ef, 0x436a, { 0xaa, 0xa1, 0x64, 0xf1, 0x6e, 0x8, 0xe0, 0x14 } })

XPCOM_TYPE_INFO_DECL(ID, interface)
// {DA28023E-E415-4706-BE07-BAB8D4AA1EC8}
XPCOM_TYPE_INFO_ID(ID, { 0xda28023e, 0xe415, 0x4706, { 0xbe, 0x7, 0xba, 0xb8, 0xd4, 0xaa, 0x1e, 0xc8 } })

}

#endif // XPCOM_TEST_PUBLIC_INTERFACE_DEF_HPP
